package com.huitone.gddw.service.dto.business;

import java.util.Date;

import com.huitone.gddw.common.excel.ColToProperty;
import com.huitone.gddw.common.excel.TabCol;
import com.huitone.gddw.utils.DateTimeUtils;
import com.huitone.gddw.utils.SysLoginUtil;

/**
 * 短信接收记录 DTO 对象
 * @author wuluodan
 *
 */
public class RecvSmDTO {

	@ColToProperty
	@TabCol(Index = 1, title = "序号", width = "30")
	private Integer seq;
	
	private String recId;
	
	private Date recvTime;
	
	@ColToProperty
	@TabCol(Index = 2, title = "日期", width = "65")
	private String recvTimeDate;
	
	@ColToProperty
	@TabCol(Index = 3, title = "短信序号", width = "120")
	private String smSeq;
	
	private String srvNode;
	
	@ColToProperty
	@TabCol(Index = 4, title = "短信发往业务端", width = "90")
	private String svrNodeName;
	
	@ColToProperty
	@TabCol(Index = 5, title = "接收号码", width = "90")
	private String userNo;
	
	@ColToProperty
	@TabCol(Index = 6, title = "短信内容", width = "150")
	private String smContent;
	
	@ColToProperty
	@TabCol(Index = 7, title = "接收时间", width = "80")
	private String recvTimeTime;
	
	private Date sendTime;
	
	@ColToProperty
	@TabCol(Index = 8, title = "发送时间", width = "80")
	private String sendTimeTime;
	
	private Integer sendCode;
	
	@ColToProperty
	@TabCol(Index = 9, title = "发送结果", width = "50")
	private String sendMsg;
	
	private String gateLinkId;
	
	private String gateLinkName;
	
	private String recvport;

	public Integer getSeq() {
		return seq;
	}

	public void setSeq(Integer seq) {
		this.seq = seq;
	}

	public String getRecId() {
		return recId;
	}

	public void setRecId(String recId) {
		this.recId = recId;
	}

	public Date getRecvTime() {
		return recvTime;
	}

	public void setRecvTime(Date recvTime) {
		this.recvTime = recvTime;
	}

	public String getRecvTimeDate() {
		if (this.recvTime != null)
			return DateTimeUtils.dateToStr(this.recvTime, "yyyy/MM/dd");
		return null;
	}

	public void setRecvTimeDate(String recvTimeDate) {
		this.recvTimeDate = recvTimeDate;
	}

	public String getSmSeq() {
		return smSeq;
	}

	public void setSmSeq(String smSeq) {
		this.smSeq = smSeq;
	}

	public String getSrvNode() {
		return srvNode;
	}

	public void setSrvNode(String srvNode) {
		this.srvNode = srvNode;
	}

	public String getSvrNodeName() {
		return svrNodeName;
	}

	public void setSvrNodeName(String svrNodeName) {
		this.svrNodeName = svrNodeName;
	}

	public String getUserNo() {
		return userNo;
	}

	public void setUserNo(String userNo) {
		this.userNo = userNo;
	}

	public String getSmContent() {
		return smContent == null ? "" : SysLoginUtil.isAdmin() ? smContent : getLikeContent(smContent);
	}
	
	private String getLikeContent(String content) {
		if (content.length() < 3) {
			return content;
		}
		StringBuffer sb = new StringBuffer("****** ");
		sb.append(content.substring(content.length() / 3, content.length() / 3 * 2));
		sb.append(" ******");
		return sb.toString();
	}

	public void setSmContent(String smContent) {
		this.smContent = smContent;
	}

	public String getRecvTimeTime() {
		if (this.recvTime != null)
			return DateTimeUtils.dateToStr(this.recvTime, "MMdd HH:mm:ss");
		return null;
	}

	public void setRecvTimeTime(String recvTimeTime) {
		this.recvTimeTime = recvTimeTime;
	}

	public Date getSendTime() {
		return sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	public String getSendTimeTime() {
		if (this.sendTime != null)
			return DateTimeUtils.dateToStr(this.sendTime, "MMdd HH:mm:ss");
		return null;
	}

	public void setSendTimeTime(String sendTimeTime) {
		this.sendTimeTime = sendTimeTime;
	}

	public Integer getSendCode() {
		return sendCode;
	}

	public void setSendCode(Integer sendCode) {
		this.sendCode = sendCode;
	}

	public String getSendMsg() {
		return sendMsg;
	}

	public void setSendMsg(String sendMsg) {
		this.sendMsg = sendMsg;
	}

	public String getGateLinkId() {
		return gateLinkId;
	}

	public void setGateLinkId(String gateLinkId) {
		this.gateLinkId = gateLinkId;
	}

	public String getGateLinkName() {
		return gateLinkName;
	}

	public void setGateLinkName(String gateLinkName) {
		this.gateLinkName = gateLinkName;
	}

	public String getRecvport() {
		return recvport;
	}

	public void setRecvport(String recvport) {
		this.recvport = recvport;
	}
	
}
